<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>首页</title>
  <script src="https://cdn.bootcss.com/zepto/1.2.0/zepto.js"></script>
</head>

<body>
  <div id="banner" style="background: #eee;">
    <dl>
      <dt>标题</dt>
      <dd>内容</dd>
    </dl>
  </div>
  <div id="custom">
    <p>标题</p>
    <img src="头像" />    
    <span>内容</span>
  </div>
  <!-- javascript -->

  <script>
    window.onload = function () {
      $.ajax({
        type: 'GET',
        url: '/get_banners',
        data: {},
        dataType: 'json',
        success: function (data) {
          let htmlSrc = ''
          data.length > 0 && data.forEach(ele => {            
            htmlSrc += '<dl>' +
              '<dt>' + ele.title + '</dt>' +
              '<dd>' + ele.description + '</dd>' +              
              '<dd><a href="' + ele.href + '">查看</a></dd>' +
            '</dl>'
          })
          document.getElementById('banner').innerHTML = htmlSrc
        }
      })
      $.ajax({
        type: 'GET',
        url: '/get_customer_evaluation_table',
        data: {},
        dataType: 'json',
        success: function (data) {
          let htmlSrc = ''          
          data.length > 0 && data.forEach(ele => {            
            htmlSrc += '<p>' + ele.title + '</p>' +
            '<img src="./upload/' + ele.src + '" width="30" height="30" />' +
            '<span>' + ele.description + '</span>'
          })
          document.getElementById('custom').innerHTML = htmlSrc
        }
      })
    }
  </script>
</body>

</html>